﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BMC.ARSystem;
using Wicresoft.EKA.NRemedy;
using System.Collections;

namespace Wicresoft.EKA.NRemedy.ConsoleTest
{
    class Program
    {
        static void Main(string[] args)
        {
            string ARServer = ConfigurationManager.AppSettings["ARServer"];
            string ARUid = ConfigurationManager.AppSettings["ARUid"];
            string ARPwd = ConfigurationManager.AppSettings["ARPwd"];

            GlobalSettings.SetCharacterEncoding("UTF8");    //GlobalSetting 里面 
            ARLoginContext context = new ARLoginContext(ARServer, ARUid, ARPwd);
            ARProxy<TestModel> ar = new ARProxy<TestModel>(context);




            DateTime startTime = DateTime.Now;
            TestModel test = new TestModel();

            //context.BeginBulkEntryTransaction();
            for (int i = 0; i < 2; i++)
            {
                test = new TestModel()
                {
                    Submitter = "Demo",
                    ShortDescription = i.ToString(),
                    CharacterField = "Char",
                    CheckBoxField = 0,
                    DateField = new BMC.ARSystem.DateValue(DateTime.Now),
                    //DateField2 = new BMC.ARSystem.DateValue(DateTime.Now),
                    DecimalNumberField = 1,
                    DiaryFieldSet = "Diary",
                    //DropDownListField = TestModel.DropDownListField_Enum.NoValue,
                    IntegerField = 1,
                    RadioButtonField = TestModel.RadioButtonField_Enum.Default1,
                    RealNumberField = 1.0,
                    TimeField = new BMC.ARSystem.TimeOfDayValue(1, 2, 3)
                };
                ar.CreateEntry(test);
            }
            //context.SendBulkEntryTransaction();

            int count;
           var entrys=   ar.GetPagedEntry(TestModel.Submitter_Name.S() + "=" + "Demo".D(),
                new List<uint> { TestModel.RequestID_ID, TestModel.ShortDescription_ID,TestModel.DropDownListField_ID },
                0, 10, out count,
                new ArrayList() { new SortInfo((int)TestModel.RequestID_ID, SortInfo.SortOrder.Descending) });

           Console.ReadLine();

            //Console.WriteLine(startTime.ToString());
            //Console.WriteLine(DateTime.Now.ToString());
        }
    }
}
